package no.sachmuld.methodcombination.examples.reflection.aopstyle.foo;

import no.sachmuld.methodcombination.api.BehaviourChain;
import no.sachmuld.methodcombination.api.CrosscuttingBehaviour;
import no.sachmuld.methodcombination.api.reflection.Crosscutting;

/**
 *
 */
public abstract class Foo {

    private BehaviourChain<CrosscuttingBehaviour> chain = new BehaviourChain<>();

    final public String bar(int i) {
        return new Crosscutting<String>().build(FooBehaviour.class, Foo.class, "bar", Integer.TYPE).execute(this, chain, i);
    }

    final public String baz(int i) {
        return new Crosscutting<String>().build(FooBehaviour.class, Foo.class, "bar", Integer.TYPE).execute(this, chain, i);
    }

    final protected Foo with(CrosscuttingBehaviour... behaviours) {
        chain.addAll(behaviours);
        return this;
    }

}
